/**
 * 
 */
package com.thor.palmmall.rest.common;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.spi.chart.SPicture;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SPictureConverter implements Converter<APicture, SPicture> {

  public static SPictureConverter getInstance() {
    if (instance == null)
      instance = new SPictureConverter();
    return instance;
  }

  private static SPictureConverter instance;

  private SPictureConverter() {
  }

  @Override
  public SPicture convert(APicture source) {
    if (source == null) {
      return null;
    }
    SPicture target = new SPicture();
    target.setCaption(source.getCaption());
    target.setId(source.getId());
    target.setName(source.getName());
    return target;
  }

}
